package com.hopes.bizz.enforcement.tenant.factory;

import com.hopes.bizz.enforcement.tenant.service.TenantConfigInitService;
import com.hopes.boss.admin.api.entity.SysTenant;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author daijie
 * @version 1.0
 * @date 2023/8/14 9:56
 * @Description: 新租户创建时候需要初始化的配置
 */
@Component
@Slf4j
public class TenantConfigInitFactory {
    @Autowired
    private List<TenantConfigInitService> tenantConfigInitServiceList;

    public void init(SysTenant tenant) {
        int i = 1;
        for (TenantConfigInitService tenantConfigInitService : tenantConfigInitServiceList) {
            log.info("step." + i + tenantConfigInitService.getName());
            tenantConfigInitService.init(tenant);
            i++;
        }
    }
}
